import { start, close } from '@/utils/nprogress'
import { defineAsyncComponent } from 'vue'
import Loading from '@/components/Loading/index.vue'

export const asyncComponent = (path: string) => defineAsyncComponent({
	loader: async () => {
		start()
		const comp = await import(`../views/${path}.vue`)
		close()
		return comp
	},
	loadingComponent: Loading
})
